package com.itheima.d6_singleInstance.hungrySingleInstance;

/**
 * 饿汉式单例模式：先赋值
 */
public class Wife {
    private String name;

    //2、提供一个当前类型的类变量
    private static Wife wife= new Wife();

    //1、私有化构造器
    private Wife() {
        name = "滴滴滴";
    }

    //3、提供一个类方法返回单例对象
    public static Wife getInstance() {
        return wife;
    }

    public void show() {
        System.out.println("我老婆是：" + name);
    }
}
